﻿using System;

namespace _45_自定义特性类_特性
{
    class Program
    {
        static void Main(string[] args)
        {

        }
    }
    
    //特性类型一般以Attribute结尾
    [AttributeUsage(AttributeTargets.Property|AttributeTargets.Method)]
    public class MyDemoAttribute : Attribute
    {
        public string Description { get; set; }
    }

    public class OrderData
    {
        [MyDemo(Description ="订单ID")]
        public int OrderID { get; set; }

        [MyDemo(Description ="添加时间")]
        public DateTime AddTime { get; set; }

        [MyDemo(Description ="计算折扣价")]
        public double Compute(double q) {
            return q * 0.98d;
        }
    }

}
